package web_pro;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class sp_edit {
	
	private int id=0;
	private String name="";
	private String keyword="";
	private String jiage="";
	private String kucun="";
	

	public String getkeyword() {
		return keyword;
	}
	public void setkeyword(String keyword) {
		this.keyword = keyword;
	}
	public String getjiage() {
		return jiage;
	}
	public void setjiage(String jiage) {
		this.jiage = jiage;
	}
	public String getkucun() {
		return kucun;
	}
	public void setkucun(String kucun) {
		this.kucun = kucun;
	}
	
	
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
//	对接bean	<jsp:setProperty  name="sp_edit" property="id"   value="123456"/> 
		this.id = id;
		System.out.println("this.id ="+this.id);
		SP_get(this.id);
	}
	//----------------------------------------------------------------------
    public void SP_get(int Vspid){
    	Connection  conn = pub_fun.getConnection();
    	String Sql_str = "select * from sp_data where SP_id="+Vspid+" ";
    	boolean Oboolean=false;
    	try {
			PreparedStatement pstat = conn.prepareStatement(Sql_str);
			ResultSet rs = (ResultSet) pstat.executeQuery();
			while(rs.next())  
	            {  
				this.setname(rs.getString("SP_name"));
				this.setkeyword(rs.getString("SP_keyword"));
				this.setjiage(rs.getString("SP_jiage"));
				this.setkucun(rs.getString("SP_kucun"));
				}  
	        pstat.close();
	        conn.close();

 
        } catch (SQLException e) {
            e.printStackTrace();
        }
	}
	public String getname() {
		return name;
	}
	public void setname(String name) {
		this.name = name;
	}
}
